#include <conio.h> 
#include <graphics.h> 
#include <math.h> 
#include <stdio.h> 
#include <stdlib.h>
#include <dos.h>

#define IMAGE_SIZE 10 

void main() 
{ 
void draw_image(int x,int y); 
void Putstar(void); 

int graphdriver=DETECT; 
int graphmode,color; 
void *pt_addr; 
int x,y,maxx,maxy,midy,midx,i; 
unsigned int size; 
registerbgidriver(EGAVGA_driver); 
initgraph(&graphdriver,&graphmode,""); 
maxx=getmaxx(); 
maxy=getmaxy(); 
midx=maxx/2; 
x=0; 
midy=y=maxy/2; 
setcolor(2); 
settextstyle(TRIPLEX_FONT,HORIZ_DIR,4); 
settextjustify(CENTER_TEXT,CENTER_TEXT); 
outtextxy(100,40,"To: XiaoYu"); 
outtextxy(midx,60,"I wish you could round the world with your lover one day!"); 
outtextxy(500,80,"From: XiaoMaZHW"); 
setcolor(RED); 
settextstyle(TRIPLEX_FONT,HORIZ_DIR,4); 
outtextxy(midx,450,"Written By Z.H.W"); 
setcolor(YELLOW); 
setbkcolor(BLACK); 
setcolor(RED); 
setlinestyle(SOLID_LINE,0,NORM_WIDTH); 
draw_image(x,y); 
size=imagesize(x,y-IMAGE_SIZE,x+(4*IMAGE_SIZE),y+IMAGE_SIZE); 
pt_addr=malloc(size); 
getimage(x,y-IMAGE_SIZE,x+(4*IMAGE_SIZE),y+IMAGE_SIZE,pt_addr); 
Putstar(); 
setcolor(WHITE); 
setlinestyle(SOLID_LINE,0,NORM_WIDTH); 
rectangle(0,0,maxx,maxy); 
while(!kbhit()&&!kbhit()&&!kbhit()) 
{ 
Putstar(); 
setcolor(RED); 
setlinestyle(SOLID_LINE,0,THICK_WIDTH); 
ellipse(midx,midy,130,50,160,30); 
setcolor(BLACK); 
ellipse(midx,midy,130,50,160,30); 
for(i=0;i<=13;i++) 
{ 
setcolor(i%2==0? LIGHTBLUE:RED); 
ellipse(midx,midy,0,360,100-8*i,100); 
delay(100); 
setcolor(LIGHTBLUE); 
ellipse(midx,midy,0,360,100-8*i,100); 
} 
putimage(x,y-IMAGE_SIZE,pt_addr,XOR_PUT); 
x=x>+maxx?0:x+6; 
putimage(x,y-IMAGE_SIZE,pt_addr,XOR_PUT); 
} 
free(pt_addr); 
closegraph(); 
/*return; */ 
} 

void draw_image(int x,int y) 
{ 
unsigned long int awr[11]; 
awr[0]=x+10;awr[1]=y-10;awr[2]=x+34;awr[3]=y-6;awr[4]=x+34;awr[5]=y+6;awr[6]=x+10; 
awr[7]=y+10;awr[9]=x+10;awr[10]=y-10; 
moveto(x+10,y-4); 
setcolor(14); 
setfillstyle(1,4); 
linerel(-3*10,-2*8); 
moveto(x+10,y); 
linerel(-3*10,0); 
setcolor(3);
setfillstyle(1,LIGHTBLUE); 
fillpoly(4,awr); 
} 

void Putstar() 
{ 
int seed=1858; 
int i,dotx,doty,h,w,color,maxcolor; 
maxcolor=getmaxcolor(); 
w=getmaxx(); 
h=getmaxy(); 
/* strand(seed);*/ 
for(i=0;i<2;i++) 
{ 
dotx=i+random(w-1); 
doty=1+random(h-1); 
color=random(maxcolor); 
setcolor(color); 
putpixel(dotx,doty,color); 
circle(dotx+1,doty+1,1); 
delay(10); 
} 
/* srand(seed);*/ 
}